package bean.dao;

import hbt.HibernateUtil;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import bean.Cliente;

public class HibertnateNegocioDAO {
	private static HibertnateNegocioDAO instancia = null;
	private static SessionFactory sf = null;
	
	public static HibertnateNegocioDAO getInstance(){
		if (instancia == null){
			sf = HibernateUtil.getSessionFactory();
			instancia = new HibertnateNegocioDAO();
		}
		return instancia;
	}
	
	public void grabarCliente(Cliente cli){
		Session sesion = sf.openSession();
		sesion.beginTransaction();
		sesion.persist(cli);
		sesion.flush();
		sesion.getTransaction().commit();
		sesion.close();
	}

}
